package com.topsun.posclient.finance.view;

import java.util.List;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.part.ViewPart;

public class PaymentView extends ViewPart {

	public static final String ID = "posclient.PaymentView";

	private Table table;

	private Text storename;
	private Text number;

	private Text balloter;
	private Text ballnumber;

	private Text balance;
	private Text remark;

	static Text dogName;
	static Combo dogBreed;
	static Canvas dogPhoto;
	static Image dogImage;
	static Text ownerName;
	static Text ownerPhone;

	public void createPartControl(Composite parent) {
		Composite container = new Composite(parent, SWT.NONE);
		// 新建GridLayout布局
		GridLayout gridLayout = new GridLayout();
		// 把子组件分成3列显示
		gridLayout.numColumns = 3;
		container.setLayout(gridLayout);
		new Label(container, SWT.NONE).setText("Dog's Name:");
		dogName = new Text(container, SWT.SINGLE | SWT.BORDER);
		// 新建水平填充的GridData
		GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
		// GridData的组件占两列显示
		gridData.horizontalSpan = 2;
		dogName.setLayoutData(gridData);
		new Label(container, SWT.NONE).setText("Breed:");
		dogBreed = new Combo(container, SWT.NONE);
		dogBreed.setItems(new String[] { "Collie", "Pitbull", "Poodle",
				"Scottie" });
		dogBreed.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
		
		gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
				| GridData.VERTICAL_ALIGN_FILL);
		gridData.verticalSpan = 4;
		Button browse = new Button(container, SWT.PUSH);
		browse.setText("Browse...");
		gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
		gridData.horizontalIndent = 5;
		browse.setLayoutData(gridData);
		Button delete = new Button(container, SWT.PUSH);
		delete.setText("Delete");
		gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
				| GridData.VERTICAL_ALIGN_BEGINNING);
		gridData.horizontalIndent = 5;
		delete.setLayoutData(gridData);
		Group ownerInfo = new Group(container, SWT.NONE);
		ownerInfo.setText("Owner Info");
		gridLayout = new GridLayout();
		gridLayout.numColumns = 2;
		ownerInfo.setLayout(gridLayout);
		gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
		gridData.horizontalSpan = 2;
		ownerInfo.setLayoutData(gridData);
		
		new Label(ownerInfo, SWT.NONE).setText("Name:");
		ownerName = new Text(ownerInfo, SWT.SINGLE | SWT.BORDER);
		ownerName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		
		new Label(ownerInfo, SWT.NONE).setText("Phone:");
		ownerPhone = new Text(ownerInfo, SWT.SINGLE | SWT.BORDER);
		ownerPhone.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		
		Button enter = new Button(container, SWT.PUSH);
		enter.setText("Enter");
		gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
		gridData.horizontalSpan = 3;
		enter.setLayoutData(gridData);

	}

	public void setFocus() {

	}
}
